/* eslint-disable */ 
<template>
 <div class="icons">
   <swiper>
     <swiper-slide v-for="(page,index) of pages" :key="index">
       <div class="icon" v-for="item of page" :key="item.id">
        <div class="icon-img">
        	 <img class="icon-img-content" :src="item.imgUrl" :alt="item.desc">
        </div>
        <p class="icon-des">{{item.desc}}</p>
       </div>
     </swiper-slide>
    </swiper>
  </div>
</template>
<script>
export default{
  name: 'HomeIcons',
  data () {
    return {
         iconList: [{
         id: '0001',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1803/95/f3dd6c383aeb3b02.png',
         desc: '景点门票'
       },{
         id: '0002',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1803/f5/a963333e1fa802.png',
         desc: '本地玩乐'
       },{
         id: '0003',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1803/54/35899492b1302802.png',
         desc: '公园'
       },{
         id: '0004',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1804/5a/13ceb38dcf262f02.png',
         desc: '一日游'
       },{
         id: '0005',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1804/ff/fdf170ee89594b02.png',
         desc: '无锡必游'
       },{
         id: '0006',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1804/95/8d02011d149bdb02.png',
         desc: '汽车票'
       },{
         id: '0007',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1803/50/26ffa31b56646402.png',
         desc: '亲子游'
       },{
         id: '0008',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1803/3e/86314b2af03b7502.png',
         desc: '水上乐园'
       },{
         id: '0009',
         imgUrl: 'http://img1.qunarzz.com/piao/fusion/1804/ff/fdf170ee89594b02.png',
         desc: '发现乐园'
       }]
    }
  },
    computed : { 
      pages () {
      const pages = []
      this.iconList.forEach((item, index) => {
        const page = Math.floor(index / 8)
        if (!pages[page]) {
          pages[page] = []
        }
        pages[page].push(item)
      })
      return pages
    }  
  }    
}
</script>
<style lang="stylus" scoped>
@import "~styles/varibles.styl"
@import "~styles/mixins.styl"
.icons >>> .swiper-container
  height: 0
  padding-bottom: 50%
.icon
   overflow:hidden
   float: left
   width: 25%
   height:0
   padding-bottom: 25%
   text-align:center
   .icon-img
      margin:.15rem auto;
      .icon-img-content
        width:1.1rem
        height1.1rem
   .icon-des
      color:$darkTextColor
      ellipsis()
</style>
